//package com.kawaiior.asoulworld.gui.soulRefiner;
//
//import com.kawaiior.asoulworld.blocks.tileEntity.compressor.TileEntitySoulRefiner;
//import net.minecraft.entity.player.EntityPlayer;
//import net.minecraft.entity.player.InventoryPlayer;
//import net.minecraft.inventory.Container;
//import net.minecraft.inventory.IContainerListener;
//import net.minecraft.inventory.Slot;
//import net.minecraft.item.ItemStack;
//import net.minecraft.tileentity.TileEntity;
//import net.minecraft.util.EnumFacing;
//import net.minecraft.util.math.BlockPos;
//import net.minecraft.world.World;
//import net.minecraftforge.common.capabilities.Capability;
//import net.minecraftforge.fml.relauncher.Side;
//import net.minecraftforge.fml.relauncher.SideOnly;
//import net.minecraftforge.items.CapabilityItemHandler;
//import net.minecraftforge.items.IItemHandler;
//import net.minecraftforge.items.SlotItemHandler;
//
//public class SoulRefinerContainer extends Container {
//
//    private int compressorProgress = 0;
//    private int soulPowerType = 0;
//    private int soulPower = 0;
//
//    public int getSoulPower() {
//        return soulPower;
//    }
//
//    public int getSoulPowerType() {
//        return soulPowerType;
//    }
//
//    public int getCompressorProgress() {
//        return compressorProgress;
//    }
//
//    private final World world;
//    private final BlockPos pos;
//
//    private final IItemHandler up;
//    private final IItemHandler side;
//    private final IItemHandler down;
//
//    public SoulRefinerContainer(EntityPlayer player, World world, int x, int y, int z)
//    {
//        this.world = world;
//        this.pos = new BlockPos(x,y,z);
//
//        TileEntity tileEntity = world.getTileEntity(this.pos);
//        Capability<IItemHandler> itemHandlerCapability = CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
//
//        this.up = tileEntity.getCapability(itemHandlerCapability, EnumFacing.UP);
//        this.down = tileEntity.getCapability(itemHandlerCapability, EnumFacing.DOWN);
//        this.side = tileEntity.getCapability(itemHandlerCapability, EnumFacing.NORTH);
//
//        InventoryPlayer inventoryPlayer = player.inventory;
//
//        this.addSlotToContainer(new SlotItemHandler(this.up,0 ,80, 44));
//        this.addSlotToContainer(new SlotItemHandler(this.down,0 ,120, 16));
//        this.addSlotToContainer(new SlotItemHandler(this.side,0 ,37, 16));
//
//
//        int[] range = new int[] {0,1,2,3,4,5,6,7,8};
//        for (int i : range){
//            this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + 18 * i, 124));
//            this.addSlotToContainer(new Slot(inventoryPlayer, i + 9, 8 + 18 * i, 66));
//            this.addSlotToContainer(new Slot(inventoryPlayer, i + 18, 8 + 18 * i, 84));
//            this.addSlotToContainer(new Slot(inventoryPlayer, i + 27, 8 + 18 * i, 102));
//        }
//    }
//
//    @Override
//    public ItemStack transferStackInSlot(EntityPlayer player, int index){
//        return ItemStack.EMPTY;
//    }
//
//    @Override
//    public boolean canInteractWith(EntityPlayer playerIn) {
//        return playerIn.world.equals(this.world) && playerIn.getDistanceSq(this.pos) <= 64.0;
//    }
//
//    @Override
//    public void detectAndSendChanges(){
//        super.detectAndSendChanges();
//        TileEntity tileEntity = this.world.getTileEntity(this.pos);
//        if (tileEntity instanceof TileEntitySoulRefiner){
//            int compressorProgress = ((TileEntitySoulRefiner)tileEntity).getCompressorProgress();
//            int soulPower = ((TileEntitySoulRefiner)tileEntity).getSoulPower();
//            int soulPowerType = ((TileEntitySoulRefiner)tileEntity).getSoulPowerType();
//            if (compressorProgress != this.compressorProgress){
//                this.compressorProgress = compressorProgress;
//                for (IContainerListener listener : this.listeners){
//                    listener.sendWindowProperty(this, 0, compressorProgress);
//                }
//            }
//            if (soulPower != this.soulPower){
//                this.soulPower = soulPower;
//                for (IContainerListener listener : this.listeners){
//                    listener.sendWindowProperty(this, 1, soulPower);
//                }
//            }
//            if (soulPowerType != this.soulPowerType){
//                this.soulPowerType = soulPowerType;
//                for (IContainerListener listener : this.listeners){
//                    listener.sendWindowProperty(this, 2, soulPowerType);
//                }
//            }
//        }
//    }
//
//    @Override
//    @SideOnly(Side.CLIENT)
//    public void updateProgressBar(int id, int data){
//        if (id == 0){
//            this.compressorProgress = data;
//        }
//        if (id == 1){
//            this.soulPower = data;
//        }
//        if (id == 2){
//            this.soulPowerType = data;
//        }
//    }
//
//
//}
